refactor: Use derived_settings to lazy load settings.#36124
Closed
refactor: Use derived_settings to lazy load settings.#36124
derived_settings to lazy load settings.#36124Conversation
kdmccormick
approved these changes
Jan 16, 2025
Member
kdmccormick
left a comment
There was a problem hiding this comment.
I verified this in the same manner as #36115
kdmccormick
requested changes
Jan 16, 2025
Member
kdmccormick
left a comment
There was a problem hiding this comment.
app@94472ac4abb9:~/edx-platform$ ./diff_settings.sh lms.envs.production lms.envs.production_new
+ DJANGO_SETTINGS_MODULE=lms.envs.production
+ ./settings_wizard.py to-json
+ DJANGO_SETTINGS_MODULE=lms.envs.production_new
+ ./settings_wizard.py to-json
+ diff settings1.json settings2.json
1570,1571d1569
< "DEFAULT_ENTERPRISE_API_URL": "http://local.openedx.io/enterprise/api/v1/",
< "DEFAULT_ENTERPRISE_CONSENT_API_URL": "http://local.openedx.io/consent/api/v1/",
1817c1815,1818
< "ENTERPRISE_CONSENT_API_URL": "http://local.openedx.io/consent/api/v1/",
---
> "ENTERPRISE_CONSENT_API_URL": {
> "@@PYREF": "_generate_default_enterprise_consent_api_url",
> "@@MODULE": "lms.envs.production_new"
> },
I think you are double-wrapping ENTERPRISE_CONSENT_API_URL-- you don't need lambda settings since it's already being assigned to a function.
a21bbac to
0e6a0a6
Compare
Some of our settings depend on the values of other settings. Rather than explicitly looking up each one in the YAML settings file, we can simply derive them based on the setting in the YAML file after all the YAML settings have been loaded.
This was a little hard to grok so I added a little example to make it easier to understand.
0e6a0a6 to
90f37d9
Compare
kdmccormick
requested changes
Jan 29, 2025
Member
kdmccormick
left a comment
There was a problem hiding this comment.
I'm going to push through the Derived Settings API refactor first, and then rebase this on top of that.
Member
|
Closed in favor of: #36205 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some of our settings depend on the values of other settings. Rather
than explicitly looking up each one in the YAML settings file, we can
simply derive them based on the setting in the YAML file after all the
YAML settings have been loaded.